package 算法回顾;

/**
 * @description:
 * @author: 小白白
 * @create: 2021-09-20
 **/

public class No300最长递增子序列 {

    public int lengthOfLIS(int[] nums) {

        int result = 1;
        int[] dp = new int[nums.length];
        dp[0] = 1;

        for (int i = 1; i < nums.length; i++) {
            dp[i] = 1;
            for (int j = 0; j < i; j++) {

                if (nums[j] < nums[i]) {
                    dp[i] = Math.max(dp[i], dp[j] + 1);
                }

            }

            result = Math.max(result, dp[i]);

        }

        return result;
    }

}
